package com.huawei.esdk.tp.domain.model;

import com.huawei.esdk.platform.common.SDKErrorCode;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.platform.common.exception.SDKException;
import com.huawei.esdk.platform.common.utils.ApplicationContextUtil;
import com.huawei.esdk.platform.nemgr.itf.IDeviceManager;
import com.huawei.esdk.tp.device.smc.ICommonCapability;
import com.huawei.esdk.tp.domain.model.bean.AuthorizeInfo;

public class AuthorizeMode
{
    private static ICommonCapability tpCommonCapability = ApplicationContextUtil.getBean("tpCommonCapability");    
    
    public SDKResult<AuthorizeInfo> loginRequest(String userName)
    {
        return tpCommonCapability.loginRequest(userName);
    }
    
    private static IDeviceManager deviceManager = (IDeviceManager) ApplicationContextUtil
            .getBean("deviceManager");

    public static IDeviceManager getDeviceManager()
    {
        return deviceManager;
    }

    public static void setDeviceManager(IDeviceManager deviceManager)
    {
    	AuthorizeMode.deviceManager = deviceManager;
    }
    
    public SDKErrorCode keepAlive()
        throws SDKException
    {
        return tpCommonCapability.keepAlive();
    }
}
